﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace base01
{

    public struct Hero
    {
        public string name;  //英雄名字
        public string remark; //英雄简介
        public int gongji; //英雄攻击
        public int fangyu; //英雄防御
    }

    public class base02
    {
        public void Test()
        {
            int a = 10;
            int b = 10;
            int c = 0;
            if (a == b)
            {
                 c = 20;
                Console.WriteLine(c);
            }
            else
            {
                Console.WriteLine(c);  //C变量在其他的代码块进行的定义，在这里不能使用
            }

            PrintHello();
            Test2();
        }


        public void Test2()
        {
            Hero hero1 = new Hero();
            hero1.name = "张三";
            hero1.remark = "一名勇敢的男子";
            hero1.gongji = 100;
            hero1.fangyu = 50;

            Hero hero2 = new Hero();
            hero2.remark = "一名勇敢的男子";
            hero2.gongji = 100;
            hero2.fangyu = 50;

            if (hero1.gongji > hero2.gongji)
            {
                Console.WriteLine(hero1.name + " 攻击力更强！");
            }
            else if (hero1.gongji < hero2.gongji)
            {
                Console.WriteLine(hero2.name + " 攻击力更强！");
            }
            else
            {
                Console.WriteLine("两人攻击力相当！");
            }
        }


        public static void PrintHello()
        {
            Console.WriteLine("hello,welcome to 2024!");
        }
    }
}
